<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>

<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="renderer" content="webkit">

    <title>征收存档系统</title>

    <!--[if lt IE 9]>
    <meta http-equiv="refresh" content="0;ie.html" />
    <![endif]-->

    <link rel="shortcut icon" href="favicon.ico"> <link href="${path}/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
    <link href="${path}/css/font-awesome.min.css?v=4.4.0" rel="stylesheet">
    <link href="${path}/css/animate.css" rel="stylesheet">
    <link href="${path}/css/style.css?v=4.1.0" rel="stylesheet">
</head>

<body class="fixed-sidebar full-height-layout gray-bg" style="overflow:hidden">
    <div id="wrapper">
        <!--左侧导航开始-->
        <nav class="navbar-default navbar-static-side" role="navigation">
            <div class="nav-close"><i class="fa fa-times-circle"></i>
            </div>
            <div class="sidebar-collapse">
                <ul class="nav" id="side-menu">
                    <li class="nav-header">
                        <div class="dropdown profile-element">
                            <!--<span><img alt="image" class="img-circle" src="img/profile_small.jpg" /></span>-->
                            <a data-toggle="dropdown" class="dropdown-toggle" href="#">
                                <span class="clear">
                               <span class="block m-t-xs"><strong class="font-bold">${user.userName}</strong></span>
                                <span class="text-muted text-xs block">${user.type.label}<b class="caret"></b></span>
                                </span>
                            </a>
                            <ul class="dropdown-menu animated fadeInRight m-t-xs">
                                <li><a href="javascript:change(${user.id});">修改密码</a></li>
                                <li class="divider"></li>
                                <li><a href="/login">安全退出</a></li>
                            </ul>
                        </div>
                        <div class="logo-element">H+</div>
                    </li>
                    <li>
                        <a href="#">
                            <i class="fa fa-home"></i>
                            <span class="nav-label">主页</span>
                            <span class="fa arrow"></span>
                        </a>
                    </li>
                    <li>
                        <a class="J_menuItem" href="${path}/household/list"><i class="fa fa-suitcase"></i> <span class="nav-label">被征收人管理 </span></a>
                    </li>
                    <li>
                        <a class="J_menuItem" href="${path}/land/editor"><i class="fa fa-map-o"></i> <span class="nav-label">土地面积认定 </span></a>
                    </li>
                    <li>
                        <a class="J_menuItem" href="${path}/housing/editor"><i class="fa fa-university"></i> <span class="nav-label">房屋面积认定 </span></a>
                    </li>
                    <li>
                        <a class="J_menuItem" href="${path}/other/appendages"><i class="fa fa-university"></i> <span class="nav-label">附属物登记 </span></a>
                    </li>
                    <li>
                        <a class="J_menuItem" href="${path}/other/subsidies"><i class="fa fa-university"></i> <span class="nav-label">老人生活补助 </span></a>
                    </li>
                    <li>
                        <a class="J_menuItem" href="${path}/calculate/editor"><i class="fa fa-university"></i> <span class="nav-label">房屋征收补偿费计算 </span></a>
                    </li>
                    <li>
                        <a href="#"><i class="fa fa-edit"></i> <span class="nav-label">汇总统计</span><span class="fa arrow"></span></a>
                        <ul class="nav nav-second-level">
                            <li>
                                <a class="J_menuItem" href="${path}/statistical"><i class="fa fa-sitemap"></i> <span class="nav-label">老人生活费补助发放汇总表</span></a>
                            </li>
                            <li>
                                <a class="J_menuItem" href="${path}/statistical"><i class="fa fa-users"></i> <span class="nav-label">房屋征收面积及补偿情况统计表</span></a>
                            </li>
                        </ul>
                    </li>
                    <c:if test="${user_type == 'root'}">
                    <li>
                        <a href="#"><i class="fa fa-edit"></i> <span class="nav-label">基础设置</span><span class="fa arrow"></span></a>
                        <ul class="nav nav-second-level">
                            <li>
                                <a class="J_menuItem" href="${path}/land/standard"><i class="fa fa-bar-chart"></i> <span class="nav-label">土地认定标准</span></a>
                            </li>
                            <li>
                                <a class="J_menuItem" href="${path}/housing/structure"><i class="fa fa-gears"></i> <span class="nav-label">房屋重置价标准</span></a>
                            </li>
                            <li>
                                <a class="J_menuItem" href="${path}/housing/structure/intoNew"><i class="fa fa-gears"></i> <span class="nav-label">房屋结构成新</span></a>
                            </li>
                            <li>
                                <a class="J_menuItem" href="${path}/housing/decorate"><i class="fa fa-gears"></i> <span class="nav-label">房屋二次装修重置标准</span></a>
                            </li>
                            <li>
                                <a class="J_menuItem" href="${path}/housing/decorate/intoNew"><i class="fa fa-gears"></i> <span class="nav-label">房屋二次装修成新率标准</span></a>
                            </li>
                            <li>
                                <a class="J_menuItem" href="${path}/housing/storefront"><i class="fa fa-gears"></i> <span class="nav-label">经营性用房补助标准</span></a>
                            </li>
                            <li>
                                <a class="J_menuItem" href="${path}/calculate/price"><i class="fa fa-gears"></i> <span class="nav-label">单价管理</span></a>
                            </li>
                        </ul>
                    </li>
                    </c:if>
                    <c:if test="${user_type == 'root'}">
                    <li>
                        <a href="#"><i class="fa fa-edit"></i> <span class="nav-label">系统设置</span><span class="fa arrow"></span></a>
                        <ul class="nav nav-second-level">
                            <li>
                                <a class="J_menuItem" href="${path}/template/list"><i class="fa fa-sitemap"></i> <span class="nav-label">模板管理</span></a>
                            </li>
                            <li>
                                <a class="J_menuItem" href="${path}/user/manage"><i class="fa fa-users"></i> <span class="nav-label">用户管理</span></a>
                            </li>
                        </ul>
                    </li>
                    </c:if>
                </ul>
            </div>
        </nav>
        <!--左侧导航结束-->
        <!--右侧部分开始-->
        <div id="page-wrapper" class="gray-bg dashbard-1">
            <div class="row border-bottom">
                <nav class="navbar navbar-static-top" role="navigation" style="margin-bottom: 0">
                </nav>
            </div>
            <div class="row content-tabs">
                <button class="roll-nav roll-left J_tabLeft"><i class="fa fa-backward"></i>
                </button>
                <nav class="page-tabs J_menuTabs">
                    <div class="page-tabs-content">
                        <a href="javascript:;" class="active J_menuTab" data-id="index_v1.html">首页</a>
                    </div>
                </nav>
                <button class="roll-nav roll-right J_tabRight"><i class="fa fa-forward"></i>
                </button>
                <div class="btn-group roll-nav roll-right">
                    <button class="dropdown J_tabClose" data-toggle="dropdown">关闭操作<span class="caret"></span>

                    </button>
                    <ul role="menu" class="dropdown-menu dropdown-menu-right">
                        <li class="J_tabShowActive"><a>定位当前选项卡</a>
                        </li>
                        <li class="divider"></li>
                        <li class="J_tabCloseAll"><a>关闭全部选项卡</a>
                        </li>
                        <li class="J_tabCloseOther"><a>关闭其他选项卡</a>
                        </li>
                    </ul>
                </div>
                <a href="login.jsp" class="roll-nav roll-right J_tabExit"><i class="fa fa fa-sign-out"></i> 退出</a>
            </div>
            <div class="row J_mainContent" id="content-main">
                <iframe class="J_iframe" name="iframe0" width="100%" height="100%" src="" frameborder="0" data-id="index_v1.html" seamless></iframe>
            </div>
            <div class="footer">
                <div class="pull-right">&copy; 2014-2017 <a href="#" target="_blank">fjrcloud.com</a>
                </div>
            </div>
        </div>
        <!--右侧部分结束-->

    </div>

    <!-- 全局js -->
    <script src="${path}/js/jquery.min.js?v=2.1.4"></script>
    <script src="${path}/js/bootstrap.min.js?v=3.3.6"></script>
    <script src="${path}/js/plugins/metisMenu/jquery.metisMenu.js"></script>
    <script src="${path}/js/plugins/slimscroll/jquery.slimscroll.min.js"></script>
    <script src="${path}/js/plugins/layer/layer.min.js"></script>

    <!-- 自定义js -->
    <script src="${path}/js/hplus.js?v=4.1.0"></script>
    <script type="text/javascript" src="${path}/js/contabs.js"></script>

    <!-- 第三方插件 -->
    <script src="${path}/js/plugins/pace/pace.min.js"></script>
    <script src="${path}/js/jquery.form.js"></script>

    <script>
        function change(id) {
            if(id == undefined)
                return false;

            var html ='\
                    <div class="ibox-content" style="overflow: hidden;height: 100%;">\
                        <form class="form-horizontal" method="post">\
                            <input type="text" name="id" style="display: none;" value="'+id+'">\
                            <div class="form-group">\
                                <label class="col-sm-2 control-label">旧密码：</label>\
                                <div class="col-sm-10"><input type="password" class="form-control" name="old"></div>\
                            </div>\
                            <div class="form-group">\
                                <label class="col-sm-2 control-label">新密码：</label>\
                                <div class="col-sm-10"><input type="password" class="form-control" name="password"></div>\
                            </div>\
                            <div class="form-group">\
                                <label class="col-sm-2 control-label">确认密码：</label>\
                                <div class="col-sm-10"><input type="password" class="form-control" name="password1"></div>\
                            </div>\
                        </form>\
                    </div>';


            layer.open({
                type: 1,
                area: ['600px','auto'],
                content: html,
                btn:['修改','取消'],
                success:function (layero, index) {
                    $(layero).find('input[name="password"]').keyup(function () {
                        if($(this).val() == $(layero).find('input[name="password1"]').val()){
                            $(layero).find('.form-group').removeClass('has-error');
                        }else{
                            $(layero).find('input[name="password1"]').parents('.form-group').addClass('has-error');
                        }
                    });
                    $(layero).find('input[name="password1"]').keyup(function () {
                        if($(this).val() == $(layero).find('input[name="password"]').val()){
                            $(layero).find('.form-group').removeClass('has-error');
                        }else{
                            $(this).parents('.form-group').addClass('has-error');
                        }

                    });
                },
                yes: function(index, layero){

                    if($(layero).find('input[name="password1"]').val() == $(layero).find('input[name="password"]').val()){

                        var options ={
                            type: "post",
                            url: '${path}/api/user/change',
                            dataType: "json",
                            uploadProgress: function (event, position, total, percentComplete) {},
                            success: function (result) {
                                if (result.code == "${result_success}") {
                                    layer.msg("修改成功");
                                    layer.close(index);
                                }else {
                                    layer.msg(result.data);
                                }
                            }
                        };

                        $('form').ajaxSubmit(options);
                    }else{
                        layer.msg("两次密码不相同");
                    }


                }
            });

            return false;
        }
    </script>
</body>

</html>
